<%@ page import="util.Decode" %>
<%@ page import="net.sf.json.JSONObject" %>
<%@ page import="server.SettingServer" %>
<%@ page import="net.sf.json.JSONArray" %>
<%@ page import="server.FileServer" %>
<%@ page import="java.util.LinkedHashMap" %>
<%@ page import="config.ApplicationConfig" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    LinkedHashMap<String, String> pageConfig = ApplicationConfig.readConfig("page.json");
    request.setCharacterEncoding(pageConfig.get("encode"));
    response.setCharacterEncoding(pageConfig.get("encode"));
    Decode decode = new Decode();
    String title = decode.urlUtf8Decode(session.getAttribute("infoTitle").toString());
    String content = decode.urlUtf8Decode(session.getAttribute("infoContent").toString());
    String returnPage = decode.urlUtf8Decode(session.getAttribute("return").toString());
    String panelColor = decode.urlUtf8Decode(session.getAttribute("panelColor").toString().toLowerCase());

    SettingServer settingServer = new SettingServer();
    settingServer.open();
    JSONObject panelColorJson = settingServer.readSettingObject("panel_color");
    if (panelColorJson.has(panelColor)) {
        panelColor = panelColorJson.getString(panelColor);
    } else {
        panelColor = panelColorJson.getString("blue");
    }
%>
<html>
<head>
    <title>信 息</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/page.css">
    <link rel="stylesheet" href="css/index.css">
</head>
<body>
<nav class="navbar navbar-inverse head" role="navigation">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse"
                    data-target="#navbar">
                <span class="sr-only">切换导航</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <%
                JSONObject logo = settingServer.readSettingObject("logo");
                settingServer.close();
                if (logo.getString("logo").equals("")) {
            %>
            <img class="navbar-brand" src="image/logo.png">
            <%
            } else {
                FileServer fileServer = new FileServer();
                fileServer.open();
            %>
            <img class="navbar-brand" src="<%=fileServer.getImage(logo.getString("logo"))%>">
            <%
                    fileServer.close();
                }
            %>
            <a class="navbar-brand" href="#"><%=logo.getString("name")%>
            </a>
        </div>
    </div>
</nav>

<div class="container text-center main">
    <div class="panel <%=panelColor%> col-sm-6 col-sm-offset-3">
        <div class="panel-heading"><h1 class="panel-title" id="title"><%=title%>
        </h1></div>
        <div class="panel-body">
            <h2 id="content"><%=content%>
            </h2>
            <%
                if (content.contains("封禁")) {
                    session.removeAttribute("user");
                }
            %>
        </div>
        <div class="panel-footer text-right">
            <a href="<%=returnPage%>" class="btn btn-primary">返回</a>
        </div>
    </div>
</div>

<%
    settingServer.open();
    JSONArray foot = settingServer.readSettingArray("foot");
    JSONObject foot0 = foot.getJSONObject(0);
    JSONObject foot1 = foot.getJSONObject(1);
    JSONObject foot2 = foot.getJSONObject(2);
%>
<div class="foot">
    <row>
        <div class="col-xs-4 col-sm-4">
            <br>
            <div class="foot_item_title">
                <p><%=decode.utf8Decode(foot0.getString("title"))%>
                </p>
            </div>
            <hr class="foot_split">
            <div class="foot_item">
                <p><%=decode.utf8Decode(foot0.getString("line0"))%>
                </p>
                <p><%=decode.utf8Decode(foot0.getString("line1"))%>
                </p>
                <p><%=decode.utf8Decode(foot0.getString("line2"))%>
                </p>
            </div>
        </div>
        <div class="col-xs-4 col-sm-4">
            <br>
            <div class="foot_item_title">
                <p><%=decode.utf8Decode(foot1.getString("title"))%>
                </p>
            </div>
            <hr class="foot_split">
            <div class="foot_item">
                <p><%=decode.utf8Decode(foot1.getString("line0"))%>
                </p>
                <p><%=decode.utf8Decode(foot1.getString("line1"))%>
                </p>
                <p><%=decode.utf8Decode(foot1.getString("line2"))%>
                </p>
            </div>
        </div>
        <div class="col-xs-4 col-sm-4">
            <br>
            <div class="foot_item_title">
                <p><%=decode.utf8Decode(foot2.getString("title"))%>
                </p>
            </div>
            <hr class="foot_split">
            <div class="foot_item">
                <p><%=decode.utf8Decode(foot2.getString("line0"))%>
                </p>
                <p><%=decode.utf8Decode(foot2.getString("line1"))%>
                </p>
                <p><%=decode.utf8Decode(foot2.getString("line2"))%>
                </p>
            </div>
        </div>
    </row>
</div>
<%
    settingServer.close();
%>
</body>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/page.js"></script>
<script src="js/ver_code.js"></script>
</html>